﻿
namespace System {
    public static class HelperClasses {
        public static T GetValue<T>(this object source, string propertyName) {
            if (propertyName == "Will power") propertyName = "WillPower";
            if (propertyName == "Hit points") propertyName = "HitPoints";
            return (T)source.GetType().GetProperty(propertyName).GetValue(source, null);
        }

        public static void SetValue<T>(this object source, object value, string propertyName) {
            if (propertyName == "Will power") propertyName = "WillPower";
            if (propertyName == "Hit points") propertyName = "HitPoints";
            source.GetType().GetProperty(propertyName).SetValue(source, value, null);
        }
    }
}
